#!/bin/bash

# DeviceMemory Compiled Error:
# error: no matching function for call to 'tex2D' 

rm -rf BusSpeedDownload.o BusSpeedReadback.o  MaxFlops.o BusSpeedDownload BusSpeedReadback  MaxFlops

CUDA_PATH="/usr/local/corex"
CUDA_ARCH=ivcore11
INC_FLAGS="-I. -I../../../config -I../../../src/cuda/common -I../../../src/common -I${CUDA_PATH}/include -I${CUDA_PATH}/extras/CUPTI/include"
LD_FLAGS="-L../../../src/cuda/common -L../../../src/common -L${CUDA_PATH}/lib64 -lcudart -lpthread -ldl -lm"

clang++ -std=c++11  -g --cuda-gpu-arch=${CUDA_ARCH} --cuda-path=${CUDA_PATH} ${INC_FLAGS} -o BusSpeedDownload.o -c BusSpeedDownload.cu
clang++ -std=c++11  -g --cuda-gpu-arch=${CUDA_ARCH} --cuda-path=${CUDA_PATH} ${INC_FLAGS} -o BusSpeedReadback.o -c BusSpeedReadback.cu
clang++ -std=c++11  -g --cuda-gpu-arch=${CUDA_ARCH} --cuda-path=${CUDA_PATH} ${INC_FLAGS} -o MaxFlops.o -c MaxFlops.cu

clang++ -std=c++11  -g --cuda-gpu-arch=${CUDA_ARCH} --cuda-path=${CUDA_PATH} ${LD_FLAGS} -o BusSpeedDownload BusSpeedDownload.o ../common/main.o ../../../src/common/*.o
clang++ -std=c++11  -g --cuda-gpu-arch=${CUDA_ARCH} --cuda-path=${CUDA_PATH} ${LD_FLAGS} -o BusSpeedReadback BusSpeedReadback.o ../common/main.o ../../../src/common/*.o
clang++ -std=c++11  -g --cuda-gpu-arch=${CUDA_ARCH} --cuda-path=${CUDA_PATH} ${LD_FLAGS} -o MaxFlops MaxFlops.o ../common/main.o ../../../src/common/*.o
